# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=windows-default-manifest
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=6.4
pkgrel=2
pkgdesc='Default Windows application manifest (mingw-w64)'
url='https://cygwin.com/'
arch=('any')
license=('BSD')
makedepends=('cvs' "${MINGW_PACKAGE_PREFIX}-gcc")
source=()
sha256sums=()
CVSROOT=":pserver:anoncvs:@sourceware.org:/cvs/cygwin-apps"
CVSMOD="$_realname"
CVS_BRANCH="release-${pkgver//\./_}"

prepare() {
  cd ${srcdir}
  msg "Connecting to sourceware.org CVS server...."
  if [ -d $CVSMOD/CVS ]; then
    cd $CVSMOD
    cvs -z3 update -d
  else
    cvs -z3 -d $CVSROOT co -r $CVS_BRANCH -f $CVSMOD
    cd $CVSMOD
  fi
}

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  cp -rf ${srcdir}/${_realname} ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}
  ./configure \
    --prefix=${MINGW_PREFIX}/${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}
  make DESTDIR=${pkgdir} install
}
